package view;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;

import com.hexidec.util.Translatrix;

import eventHandling.EventBus;
import eventHandling.EventTyp.Type;

public class UserCheckerView extends JPanel {
	private JButton btnRight;
	private JButton btnWrong;
	private JButton btnShowMeTheAnswer;
	
	private EventBus eventBus;

	public UserCheckerView(EventBus eventBus) {
		super();
		this.eventBus = eventBus;
		initButtons();
	}

	@Override
	public void setVisible(boolean aFlag) {
		super.setVisible(aFlag);
	}

	private void initButtons() {
		btnRight = new JButton(Translatrix.getTranslationString("right"));
		btnWrong = new JButton(Translatrix.getTranslationString("wrong"));
		btnShowMeTheAnswer = new JButton(Translatrix.getTranslationString("show_me_the_answer"));
		
		btnRight.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				eventBus.fireEvent(Type.ANSWER_IS_RIGHT);
			}
		});
		
		btnWrong.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				eventBus.fireEvent(Type.ANSWER_IS_WRONG);
			}
		});
		
		btnShowMeTheAnswer.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				eventBus.fireEvent(Type.SHOW_CORRECT_ANSWER);
			}
		});
	}

	public JButton getBtnWrong() {
		return btnWrong;
	}

	public JButton getBtnShowMeTheAnswer() {
		return btnShowMeTheAnswer;
	}

	public JButton getBtnRight() {
		return btnRight;
	}
	
	
	
}
